<template>
	<view class="index">
		<view class="form-item">
			<view class="label">
				客服电话：
			</view>
			<view class="value">
				<input type="number" v-model="form.serviceTel" class="input" maxlength="11" placeholder="请输入" />
			</view>
		</view>

		<view class="submit-btn" @click="submit">
			保存
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					id: '',
					serviceTel: ''
				}
			}
		},
		computed: {
			cityPointInfo() {
				return this.$store.state.userInfo.cityPointInfo
			}
		},
		mounted() {
			this.form = {
				id: this.cityPointInfo.id,
				serviceTel: this.cityPointInfo.serviceTel
			}
		},
		methods: {
			async submit() {
				if (!this.form.serviceTel) {
					uni.showToast({
						title: '请输入客服电话',
						icon: 'none'
					})
					return
				}

				const data = await this.$api.put('/app/pickuppoint', this.form)
				if (data.code === 200) {
					this.$store.commit('setUserInfo')
					uni.navigateBack()
				}
			}
		},
		components: {

		}
	}
</script>

<style lang="scss" scoped>
	.index {
		height: 100%;
		overflow: hidden;

		.form-item {
			min-height: 90upx;
			background-color: #ffffff;
			display: flex;
			align-items: center;
			padding: 0 34upx;
			font-size: 32upx;
			color: #212121;
			margin-top: 10upx;

			.value {
				flex: 1;

				.input {
					width: 100%;
					text-align: right;
				}

				.textarea {
					width: 100%;
					text-align: right;
					height: 100upx;
					padding: 15upx 0;
				}
			}
		}

		.submit-btn {
			width: 600upx;
			margin: 100upx 75rpx;
			height: 80upx;
			display: flex;
			align-items: center;
			justify-content: center;
			color: #ffffff;
			font-size: 32upx;
			background-color: #F26022;
			border-radius: 20upx;
		}
	}
</style>